import type { GreasyForkElements } from '../../../../../../../../types/constants/personalization/greasy_fork'
import {
  PAGE_ELEMENTS,
  PROJECT_PREFIX,
  SUPPORTED_PLATFORMS,
} from '../../../../../../../../types/constants'
import { CommonPage } from './common'

// 测试链接：https://greasyfork.org/zh-CN/search
export class SearchPage {
  elements: GreasyForkElements = PAGE_ELEMENTS[SUPPORTED_PLATFORMS.GREASY_FORK]
  private static instance: SearchPage
  private commonPage: CommonPage = CommonPage.getInstance()

  /**
   * 获取单例实例
   */
  public static getInstance(): SearchPage {
    if (!SearchPage.instance) {
      SearchPage.instance = new SearchPage()
    }
    return SearchPage.instance
  }

  init(): void {}

  getMainStyles(): string {
    return `
.text-content {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 40px;
  background-color: var(--${PROJECT_PREFIX}-theme-bg-base) !important;
  border: none !important;
  box-shadow: none !important;
  margin-top: 0 !important;
  padding: 40px 16px !important;
  
  h3 {
    margin-top: 0 !important;
    color: var(--${PROJECT_PREFIX}-theme-text-primary) !important;
  }
  
  p {
    color: var(--${PROJECT_PREFIX}-theme-text-secondary) !important;
  }
  
  ${this.commonPage.searchStyles(false)}
}
`
  }
}
